


<?php 

if ($_GET) {

header("Content-type:application/octet-stream");

$get = iconv("UTF-8","gb2312", $_GET['name']);
$fileName = basename($get);


header("Content-Disposition:attachment;filename={$fileName}");

header("Accept-ranges:bytes");

header("Accept-length:".filesize($get));

readfile($get);
if (readfile($get)) {
	echo "<script type='text/javascript'>alert('恭喜你，下载成功!');</script>";
}

}


// $file="./Upload/2016-04-11/robots.txt";

// header("Content-type:application/octet-stream");

//二进制文件
// $fileName = basename($file);

//获得文件名  
// header("Content-Disposition:attachment;filename={$fileName}");
//下载窗口中显示的文件名
// header("Accept-ranges:bytes");
//文件尺寸单位  
// header("Accept-length:".filesize($file));
//文件大小  
// readfile($file);
//读出文件内容



 ?>